Skip to content

Prefer SMTP_SERVER over local mail command for email reports - #21

Merged
locus313 merged 1 commit into
mainfrom
fix/smtp-precedence-over-local-mail
Aug 24, 2026
Merged

Prefer SMTP_SERVER over local mail command for email reports#21
locus313 merged 1 commit into
mainfrom
fix/smtp-precedence-over-local-mail

Conversation

@locus313

Copy link
Copy Markdown
Collaborator

Summary

Fixes a case reported after merging #20: on a server with a local mail
command configured via msmtp, authentication was failing (CRAM-MD5
rejected by the relay), even though the user had also configured
SMTP_SERVER/SMTP_AUTH_USER/etc. for this script's SMTP fallback.

Root cause: send_email_report always tried the local mail command
first and only used the SMTP/curl path if mail was missing entirely — so
a misconfigured local MTA blocked delivery even with a working relay
configured explicitly for this script.

Change

If SMTP_SERVER is set, send directly via curl (bypassing mail
entirely). Otherwise fall back to the local mail command as before.

Testing

  • shellcheck clean (pre-existing intentional-glob info only).
  • Stubbed both mail (forced failure) and curl to confirm SMTP_SERVER
    now takes priority and mail is never invoked when it's set.
  • README updated to describe the new precedence.

… command

If SMTP_SERVER is explicitly configured, send the report directly via curl
instead of the local 'mail' command. Previously 'mail' was always tried
first and only fell back to SMTP if 'mail' was missing entirely, so a
misconfigured local MTA (e.g. msmtp CRAM-MD5 auth failures) would block
delivery even when a working SMTP relay was configured.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@locus313
locus313 merged commit ec37e30 into main Aug 24, 2026
1 check passed
@locus313
locus313 deleted the fix/smtp-precedence-over-local-mail branch August 24, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant